import { BASE_URL } from './config'

export default function(options) {
  return new Promise((resolve, reject) => {
    // 封装
    wx.request({
      url: BASE_URL + options.url,
      timeout: 7000,
      method: options.method || 'get',
      data: options.data || {},
      success: res => {
        resolve(res.data)
      },
      fail: reject
    })
  })
}